FROM php:7.2.28-fpm-alpine3.11
# 添加阿里云源，不然很慢的
RUN echo https://mirrors.aliyun.com/alpine/v3.11/main > /etc/apk/repositories && \
echo https://mirrors.aliyun.com/alpine/v3.11/community >> /etc/apk/repositories
RUN apk update && apk upgrade
# 基础文件
RUN apk add --no-cache autoconf g++ libtool make curl-dev libxml2-dev linux-headers
# mysql 扩展
RUN docker-php-ext-install pdo_mysql
# redis 扩展
RUN apk add autoconf gcc g++ make
RUN pecl install redis-4.0.1 && docker-php-ext-enable redis
# swoole 扩展
RUN apk add autoconf openssl openssl-dev libzip
RUN pecl install swoole && docker-php-ext-enable swoole
# RUN pecl install pcntl && docker-php-ext-enable pcntl
RUN docker-php-ext-install -j 2 zip

RUN rm -rf /var/cache/apk/*

### Install PHP Composer 设置阿里云代理
RUN curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer && \
composer config -g repo.packagist composer https://mirrors.aliyun.com/composer/